package com.neusoft.dao;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.After;
import org.junit.Before;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neusoft.entity.User;

@Repository
public class UserMapperImp implements UserMapper {
	
	public SqlSessionTemplate getSst() {
		return sst;
	}

	public void setSst(SqlSessionTemplate sst) {
		this.sst = sst;
	}

	@Autowired
	private SqlSessionTemplate sst = null;
	
	@Override
	public List<User> getUsers() {
		// TODO Auto-generated method stub

		List<User> list= sst.selectList("getUsers");

		return list;
	}

	@Override
	public User getUserbyAccout(String account) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean updateUser(User user) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean deleteUser(String account) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int insertUser(User user) {
		// TODO Auto-generated method stub
		int code= sst.insert("insertUser", user);
		return code;
		
	}

	@Override
	public int deleteUser(int user_id) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public User getUserbyUserId(int user_id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateUserbyId(User user) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public User checkuser(User user) {
		// TODO Auto-generated method stub
		return sst.selectOne("checkuser", user);
	}

}
